<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <input type="button" value="test1" id="btn1" /> -->
    <div class="headert">
        <img src="" alt="图片" class="img">
    </div>
</body>

</html>
<script>
    var n = 9;
    function fn(n) {
        var a = [" "," "," "," "," "," "," "," "," "];
        for (var i = 1; i <= 9; i++) {
            var s = " *";
            a.push(s);
            a.shift();
            console.log(a.join(" "));
        }
    }
    var a = fn(n);


    function fn2() {
        for (var i = 1; i <= 9; i++) {
            for (var j = 1; j <= i; j++) {
                document.write(j + "*" + i + "=" + j * i + " ");
            }
            document.write("</br>");
        }
    }
    fn2()

    var s1 = [];
    var s2 = [];
    for (var i = 1; i <= 100; i++) {
        if (i % 2 == 0) {
            s1.push(i)
        } else {
            s2.push(i)
        }
    }
    document.write("偶数:" + s1);
    document.write("奇数:" + s2);

    var str = "hello world";
    console.log(str.match(/hello*/));
    console.log(str.match(/hello+/));
    console.log(str.match(/hello?/));
    console.log(str.match(/hello|world/));
    console.log(str.match(/^hello/));
    console.log(str.match(/world$/));
    console.log(str.match(/[abod]/));
    console.log(str.match(/[^abcd]+/));
    console.log(str.match(/\w/));
    console.log(str.match(/\w+/));
    console.log(str.match(/\W/));
    console.log(/\d/g.exec(str)); 
    console.log(/\D+/g.exec(str));
    console.log(/\s/g.exec(str)); 
    console.log(/\S+/g.exec(str));
    console.log(/\lo\b/g.exec(str));
    console.log(/\ll\B/g.exec(str)); 
    console.log(/\n/g.exec(str)); 


    var sum = num(350);
    function num(n){
        var s = 0;
        if(n >= 500){
            s += n * 0.5;
        }
        else if(200 <= n < 500){
            s += n * 0.8
        }
        else{
            s += n;
        }
        return s;
    }
    console.log(sum);

    var headert = document.getElementsByClassName("headert");
    var img = document.getElementsByClassName("img");

</script>